import Vue from 'vue'
import Router from 'vue-router'
import layout from '@/components/layout.vue'
import view from '@/components/view.vue'
import usersManage from './module/usersManage' // 用户管理
import runManage from './module/runManage' // 运营管理
import customerService from './module/customerService' // 客服中心
import report from './module/report' // 报表中心
import systemManage from './module/systemManage'
import financeManage from './module/financeManage' // 财务管理
Vue.use(Router)

export default new Router({
    mode: 'history',
    base: process.env.BASE_URL,
    routes: [
        {
            path: '/',
            component: layout,
            children: [
                // 首页
                {
                    path: '/',
                    component: () => import('@/pages/home/index')
                },
                // 用户管理模块
                {
                    path: 'users',
                    component: view,
                    children: usersManage
                },
                // 运营管理模块
                {
                    path: 'run',
                    component: view,
                    children: runManage
                },
                // 财务管理模块
                {
                    path: 'finance',
                    component: view,
                    children: financeManage
                },
                // 客服中心
                customerService,
                // 报表
                report,
                // 系统管理模块
                {
                    path: 'system',
                    component: view,
                    children: systemManage
                }
            ]
        },
        // 登录
        {
            path: '/login',
            component: () => import('@/pages/login/index')
        },
        // 404
        {
            path: '*',
            component: () => import('@/pages/404/index')
        }
    ]
})
